<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/XGameAdmin_template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>XGame</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->

<!-- InstanceEndEditable -->
<link type="text/css" rel="stylesheet" href="CSS/adminCSS.css" />
</head>
<?php
include('admin_lock.php');
if($_SERVER["REQUEST_METHOD"] == "POST")
{
	if(!empty($_POST['viewID']))
	{
		$id=addslashes($_POST['viewID']);
		$q="select * FROM `order` where user_ID='$id'";
	}
	else
	{
		$q="select * FROM `order`";
	}
}
else{
	$q="select * FROM `order`";
}
$result=mysql_query($q);
?>
<body>
<div id="container">

<div id="wrapper">

<div id="banner">
<ul class="topLink">
<li> Welcome, Admin </li>
<li> <a href="Logout.php"> Logout </a> </li>
</ul>
<img src="Assets/XGame.png" alt="XGame" />
</div>

<div id="menu">

<ul class="nav">
<li> <a href="AdminMember.php"> Member </a> </li>
<li> <a href="AdminNews.php"> News </a> </li>
<li> <a href="AdminGames.php"> Games </a> </li>
<li> <a href="AdminStock.php"> Stock </a> </li>
<li> <a href="AdminOrder.php"> Order </a> </li>
<li> <a href="AdminHistory.php"> History </a> </li>
</ul>

</div>

<div id="main">
<!-- InstanceBeginEditable name="Main" -->
<table border="0" class="table" width="750px">
<tr align="center">
<th class="tableHeader"> Order ID </th>
<th class="tableHeader"> Member ID </th>
<th class="tableHeader"> Order Date </th>
<th class="tableHeader"> Location ID </th>
<th class="tableHeader"> Total Price </th>
<th class="tableHeader"> Order Status </th>
<th colspan="2" class="tableHeader"> Action </th>
</tr>

<?php
while($data_fetch=mysql_fetch_array($result))
{
echo "<tr align='center'>";
echo "<td class='tableContent'>". $data_fetch['order_ID'] ."</td>";
$id = $data_fetch['order_ID'];
echo "<td class='tableContent'>". $data_fetch['user_ID'] ."</td>";
echo "<td class='tableContent'>". $data_fetch['order_date'] ."</td>";
echo "<td class='tableContent'>". $data_fetch['location_ID'] ."</td>";
echo "<td class='tableContent'>". $data_fetch['order_total_price'] ."</td>";
echo "<td class='tableContent'>". $data_fetch['order_status'] ."</td>";
?>

<td class="tableContent">
<form name="view" action="OrderGame.php" method="POST">
<input type="hidden" name="viewID" value="<?php echo "$id"; ?>"/>
<input type="submit" name="view" value="View Game"/>
</form>
</td>

<td class="tableContent">
<form name="paid" action="PaidSQL.php" method="POST">
<input type="hidden" name="paidID" value="<?php echo "$id"; ?>"/>
<input type="submit" onClick="window.location.href=window.location.href" name="paid" value="Paid"/>
</form>
</td>
<?php
echo "</tr>";

}
?>
</table>
<!-- InstanceEndEditable -->
</div>

<div id="footer">
<p align="center"> &copy; &nbsp; 2012 XGame </p>
</div>

</div>

</div>

</body>
<!-- InstanceEnd --></html>
